package bairui.international.controller.branch.branch.area;

/**
 * @see bairui.international.controller.branch.branch.area.AddPage_BaseFilter
 *
 */
class AddPage_Filter

{
	
	/**
	 * 过滤扩展接口
	 */
	static interface FilterExtends {
		com.querydsl.core.types.Predicate gainProvince(
			bairui.international.model.domain.jpa.TB_Province province
		);
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_Town QRoot,
		javax.servlet.http.HttpServletRequest request
		,FilterExtends filterExtends
	) {
		com.querydsl.core.BooleanBuilder query = query(
				QRoot
	,			com.sh_lianjing.string.util.Util_String.parseToType(
						request.getParameter("name"), 
						String.class, 
						"yyyy-MM-dd"
					)
			);
			/* comment 附加过滤属性 */
			if(null != request.getParameter("province.id")){
				query.and(filterExtends.gainProvince(
					new bairui.international.model.domain.jpa.TB_Province(com.sh_lianjing.string.util.Util_String.parseToType(
							request.getParameter("province.id"), 
							Long.class, 
							"yyyy-MM-dd"
						))
				));
			}
	;
		return query;
	}
	
	final static com.querydsl.core.BooleanBuilder query(
		bairui.international.model.domain.jpa.QTB_Town QRoot
	,	String name
	) {
		com.querydsl.core.BooleanBuilder builder = new com.querydsl.core.BooleanBuilder();
	
		if(null != name){
			builder.and(QRoot.name.like("%"+name+"%"));
		}
		return builder;
	}
	
}
